/***************************************************************************
 *   Copyright (C) 2009 - 2010 by Simon Qian <SimonQian@SimonQian.com>     *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef __VSFHAL_CONST_H_INCLUDED__
#define __VSFHAL_CONST_H_INCLUDED__

#include "MM32F103.h"

// common
#define VSFHAL_DUMMY_PORT					0xFF

// core
#define VSFHAL_SLEEP_WFI					(0x1ul << 0)
#define VSFHAL_SLEEP_PWRDOWN				(0x1ul << 1)

// GPIO
#define VSFHAL_GPIO_INPUT					0x04
#define VSFHAL_GPIO_PULLUP					0x88
#define VSFHAL_GPIO_PULLDOWN				0x08
//#define VSFHAL_GPIO_INP						0x08
#define VSFHAL_GPIO_OUTPP					0x01
#define VSFHAL_GPIO_OUTOD					0x05
#define VSFHAL_GPIO_ANALOG					0x00
#define VSFHAL_GPIO_AFOD					0x0F
#define VSFHAL_GPIO_AFPP					0x0B

// USART
#define vsfhal_usart_t						uint32_t
#define stm32_USART_MODE0					0x00
#define stm32_USART_MODE1					0x04
#define stm32_USART_MODE2					0x08
#define stm32_USART_MODE3					0x0C
#define stm32_USART_CLKEN					0x80
#define stm32_USART_STOPBITS_0P5			0x20
#define stm32_USART_STOPBITS_1				0x00
#define stm32_USART_STOPBITS_1P5			0x60
#define stm32_USART_STOPBITS_2				0x40
#define stm32_USART_PARITY_NONE				0x00
#define stm32_USART_PARITY_ODD				0x03
#define stm32_USART_PARITY_EVEN				0x02

// USBD
#define VSFHAL_HAS_USBD

// I2C
#define vsfhal_i2c_t						uint8_t

#endif	// __VSFHAL_CONST_H_INCLUDED__
